import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {
    createSvgIconsPlugin
} from 'vite-plugin-svg-icons';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {
    ElementPlusResolver
} from 'unplugin-vue-components/resolvers'

export default defineConfig({
    base: '/hospital-vue',
    server: {
        port: 3000,
        //是否弹出浏览器
        open: false,
        //允许跨域
        cors: true,
        host: true,
    },
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
        //引入SVG图标素材文件
        createSvgIconsPlugin({
            iconDirs: [resolve(process.cwd(), 'src/icons/svg')],
            symbolId: '[name]',
        })
    ],
    resolve:{
      alias:{
        "@": resolve(__dirname, "./src")
      },
      extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
    }
})
